<?php

namespace Mediacosmos\UserBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;

class UserController extends Controller
{
    public function registerAction()
    {
        $request = $this->get('request');
        if($request->getMethod() == 'POST'){
            $typeCompte = $request->request->get('fos_user_registration_form');
            
            if(isset($typeCompte['typeCompte']) && $typeCompte['typeCompte'] == '1'){
                return $this->container
                            ->get('pugx_multi_user.registration_manager')
                            ->register('Mediacosmos\UserBundle\Entity\Artist');
            }else{
                return $this->container
                        ->get('pugx_multi_user.registration_manager')
                        ->register('Mediacosmos\UserBundle\Entity\Member');
            }
        }else{
            return $this->container
                        ->get('pugx_multi_user.registration_manager')
                        ->register('Mediacosmos\UserBundle\Entity\Member');
        }
    }
}
